package cn.iocoder.yudao.module.social.convert.container;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.social.api.container.dto.ContainerReqDTO;
import cn.iocoder.yudao.module.social.api.container.dto.ContainerRespDTO;
import cn.iocoder.yudao.module.social.controller.admin.container.vo.ContainerCreateReqVO;
import cn.iocoder.yudao.module.social.controller.admin.container.vo.ContainerRespVO;
import cn.iocoder.yudao.module.social.controller.admin.container.vo.ContainerUpdateReqVO;
import cn.iocoder.yudao.module.social.dal.dataobject.container.ContainerDO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * 容器 Convert
 *
 * @author 芋道源码
 */
@Mapper
public interface ContainerConvert {

    ContainerConvert INSTANCE = Mappers.getMapper(ContainerConvert.class);

    @Mapping(target = "id", ignore = true)
    ContainerDO convert(ContainerCreateReqVO bean);

    @Mapping(target = "permission", ignore = true)
    @Mapping(target = "creatorUserId", ignore = true)
    ContainerDO convert(ContainerUpdateReqVO bean);

    ContainerRespVO convert(ContainerDO bean);

    List<ContainerRespVO> convertList(List<ContainerDO> list);

    PageResult<ContainerRespVO> convertPage(PageResult<ContainerDO> page);

    // API 转换方法
    ContainerRespDTO convertApi(ContainerDO bean);

    List<ContainerRespDTO> convertApiList(List<ContainerDO> list);

    @Mapping(target = "permission", ignore = true)
    @Mapping(target = "creatorUserId", ignore = true)
    ContainerCreateReqVO convertToCreateReqVO(ContainerReqDTO bean);

    @Mapping(target = "id", ignore = true)
    @Mapping(target = "permission", ignore = true)
    @Mapping(target = "creatorUserId", ignore = true)
    ContainerUpdateReqVO convertToUpdateReqVO(ContainerReqDTO bean);

}
